{% extends 'base.html' %}
{% load static %}

{% block title %}申请借用资产{% endblock %}

{% block content %}
<div class="container">
    <div class="row justify-content-center">
        <div class="col-md-8">
            <div class="card">
                <div class="card-header">
                    <h3 class="mb-0">申请借用资产</h3>
                </div>
                <div class="card-body">
                    <form method="post">
                        {% csrf_token %}
                        
                        {% if form.non_field_errors %}
                            <div class="alert alert-danger">
                                {% for error in form.non_field_errors %}
                                    <p>{{ error }}</p>
                                {% endfor %}
                            </div>
                        {% endif %}

                        <div class="mb-3">
                            <label for="{{ form.asset.id_for_label }}" class="form-label">{{ form.asset.label }}</label>
                            {{ form.asset }}
                            {% if form.asset.help_text %}
                                <small class="form-text text-muted">{{ form.asset.help_text }}</small>
                            {% endif %}
                            {% for error in form.asset.errors %}
                                <div class="invalid-feedback d-block">{{ error }}</div>
                            {% endfor %}
                        </div>

                        <div class="mb-3">
                            <label for="{{ form.reason.id_for_label }}" class="form-label">{{ form.reason.label }}</label>
                            {{ form.reason }}
                             {% for error in form.reason.errors %}
                                <div class="invalid-feedback d-block">{{ error }}</div>
                            {% endfor %}
                        </div>

                        <button type="submit" class="btn btn-primary">
                            <i class="fas fa-paper-plane me-2"></i>提交申请
                        </button>
                        <a href="{% url 'assets:asset_list' %}" class="btn btn-secondary">取消</a>
                    </form>
                </div>
            </div>
        </div>
    </div>
</div>
{% endblock %}